// /common/http.api.js


// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
    // 轮播图
    let baseInfo = (params = {}) => vm.$u.get('/index/baseInfo', params);
    //手机号密码登录
    let login = (params = {}) => vm.$u.get('/user/login', params);

    //手机号验证码登录
    let mobilelogin = (params = {}) => vm.$u.get('/user/mobilelogin', params);

    // 创建用户生成 / 验证codeImg
    let getCaptcha = (params = {}) => vm.$u.get('/other/captcha', params);

    // 发送短信验证码
    let smsSend = (params = {}) => vm.$u.post('/sms/send', params);

    // 验证短信验证码
    let smsCheck = (params = {}) => vm.$u.post('/sms/check', params);

    // 注册
    let register = (params = {}) => vm.$u.get('/user/register', params);

    // 获取盲盒分类
    let categoryList = (params = {}) => vm.$u.get('/index/categoryList', params);

    // 获取盲盒列表
    let getBoxList = (params = {}) => vm.$u.get('/index/getBoxList', params);

    // 获取盲盒详情
    let getBoxDetail = (params = {}) => vm.$u.get('/index/boxDetail', params);

    // 获取盲盒开奖记录
    let getBoxOpenRecord = (params = {}) => vm.$u.get('/index/boxOpenRecord', params);

    //创建盲盒订单
    let boxCreateOrder = (params = {}) => vm.$u.get('/index/createOrder', params);

    // 盲盒钻石支付
    let boxCoinPay = (params = {}) => vm.$u.get('/index/coinPay', params);

    // 回收奖品
    let exchange = (params = {}) => vm.$u.get('/user/exchange', params);

    // 福利房分类
    let getRoomCategory = (params = {}) => vm.$u.get('//room/getRoomCategory', params);

    // 福利房列表
    let getRoomList = (params = {}) => vm.$u.get('/room/getRoomList', params);

    // 福利房中奖记录
    let getRoomRecord = (params = {}) => vm.$u.get('/room/roomRecord', params);

    // 福利房详情
    let getRoomDetail = (params = {}) => vm.$u.get('/room/roomDetail', params);

    // 福利房详情--参与人
    let getRoomUser = (params = {}) => vm.$u.get('//room/roomUser', params);

    // 加入福利房
    let intoRoom = (params = {}) => vm.$u.get('/room/intoRoom', params);

    // 福利房详情--中奖人
    let getRoomPrizeUser = (params = {}) => vm.$u.get('/room/roomPrizeUser', params);

    // 获取自定义商品
    let getCustomBoxGoodsList = (params = {}) => vm.$u.get('/box/customBoxGoodsList', params);

    // 获取奖品中奖概率
    let getPrizeRate = (params = {}) => vm.$u.get('/box/getPrizeRate', params);

    // 创建自定义盲盒订单
    let createCustomBoxOrder = (params = {}) => vm.$u.get('/box/createCustomBoxOrder', params);

    // 自定义盲盒支付--开奖
    let customBoxCoinPay = (params = {}) => vm.$u.get('/box/customBoxCoinPay', params);

    // 获取分类列表
    let getCategoryList = (params = {}) => vm.$u.get('shop/getCategoryList', params);

    // 获取商城筛选条件
    let getFilterList = (params = {}) => vm.$u.get('/shop/getFilterList', params);

    // 获取商城列表
    let getGoodsList = (params = {}) => vm.$u.get('/shop/getGoodsList', params);

    // 创建商城订单
    let createOrder = (params = {}) => vm.$u.get('/shop/createOrder', params);

    // 钻石支付商城订单
    let coinPay = (params = {}) => vm.$u.get('/shop/coinPay', params);

    // 红包获取接口
    let getRedPacket = (params = {}) => vm.$u.get('/other/getRedPacket', params);

    // 修改steam交易链接
    let modifySteamUrl = (params = {}) => vm.$u.get('/user/modifySteamUrl', params);

    // 修改密码
    let updatePassword = (params = {}) => vm.$u.post('/user/changepwd', params);

    // 修改用户昵称
    let modifyNickname = (params = {}) => vm.$u.get('/user/modifyNickname', params);

    // 换绑手机
    let changemobile = (params = {}) => vm.$u.get('/user/changemobile', params);

    // 重置密码
    let resetpwd = (params = {}) => vm.$u.get('/user/resetpwd', params);

    // 实名认证
    let checkRealName = (params = {}) => vm.$u.get('/user/checkRealName', params);

    // 邀请人绑定
    let bindRelation = (params = {}) => vm.$u.get('/user/bindRelation', params);

    // 注销用户
    let destroyUser = (params = {}) => vm.$u.get('/user/destroyUser', params);

    // 我的背包
    let mybox = (params = {}) => vm.$u.get('/user/mybox', params);

    // 获取常见问题列表数据
    let getProblemList = (params = {}) => vm.$u.get('/other/getProblemList', params);

    // 申请发货
    let applyDelivery = (params = {}) => vm.$u.post('/user/applyDelivery', params);

    // 提交反馈意见
    let subAdvise = (params = {}) => vm.$u.get('/other/subAdvise', params);

    // 用户信息--我的
    let getUserInfo = (params = {}) => vm.$u.get('/user/userInfo', params);

    // 充值配置列表
    let getRechargeList = (params = {}) => vm.$u.get('/index/rechargeList', params);

    //创建充值订单
    let createRechargeOrder = (params = {}) => vm.$u.get('/index/createRechargeOrder', params);

    // 分享明细
    let getRetailList = (params = {}) => vm.$u.get('/retail/getRetailList', params);

    // 排行榜
    let getRankingList = (params = {}) => vm.$u.get('/other/getRankingList', params);

    // 我的订单列表
    let myOrderList = (params = {}) => vm.$u.get('/user/myOrderList', params);

    // 金币（商城积分）转至钻石
    let scoreToCoin = (params = {}) => vm.$u.get('/user/scoreToCoin', params);

    // 我的资金（钻石收支统计）
    let getMyCoin = (params = {}) => vm.$u.get('/user/myCoin', params);

    // 积分明细
    let getShopScore = (params = {}) => vm.$u.get('/user/myShopScore', params);

    // 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
    vm.$u.api = {
        baseInfo,
        login,
        mobilelogin,
        getCaptcha,
        smsSend,
        smsCheck,
        register,
        categoryList,
        getBoxList,
        getBoxDetail,
        getBoxOpenRecord,
        boxCreateOrder,
        getRoomCategory,
        getRoomList,
        getRoomRecord,
        getRoomDetail,
        getRoomUser,
        intoRoom,
        getRoomPrizeUser,
        getCustomBoxGoodsList,
        getPrizeRate,
        createCustomBoxOrder,
        customBoxCoinPay,
        boxCoinPay,
        exchange,
        getGoodsList,
        getFilterList,
        getCategoryList,
        createOrder,
        coinPay,
        getRedPacket,
        modifySteamUrl,
        updatePassword,
        modifyNickname,
        changemobile,
        resetpwd,
        checkRealName,
        bindRelation,
        destroyUser,
        mybox,
        getProblemList,
        applyDelivery,
        subAdvise,
        getUserInfo,
        getRechargeList,
        createRechargeOrder,
        getRetailList,
        getRankingList,
        myOrderList,
        scoreToCoin,
        getMyCoin,
        getShopScore,
    };
}

export default {
    install
}